package com.boho.system.dao;


             
/**
 * @File name:  TSysActionDao.java 
 * @Create on:  2010-05-10 11:07:10
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           

            
import java.sql.Connection;
import java.util.LinkedList;
import java.util.List;

import cn.boho.framework.po.CQuery;
import cn.boho.framework.po.CQueryFactoryTool;
import cn.boho.framework.po.DAO;
            
        /**
 * 【系统操作:T_SYS_ACTION】的Dao操作类
 * 
 */
public class TSysActionDao extends DAO {
	
	/**
	* 查询功能包含的操作【操作表:T_SYS_ACTION】信息
	* @param con
	* @param functionLevel 功能类型
	* @return
	* @throws Exception
	* @author 陈伟
	*
	*/
	@SuppressWarnings("unchecked")
	public static List queryActionByFunctionLevel(Connection con)throws Exception{
		List list = new LinkedList();
		StringBuffer sql = new StringBuffer();
		sql.append("select a.ACTION_ID, a.ACTION_NAME,fa.FUNCTION_ID, f.FUNCTION_LEVEL from T_ACTION a ")
		.append("inner join T_FUNCTION_ACTION fa on a.ACTION_ID = fa.ACTION_ID ")
		.append("inner join T_FUNCTION f on fa.FUNCTION_ID = f.FUNCTION_ID ")
		.append("order by a.ACTION_ID asc");
		CQuery query = CQueryFactoryTool.createFactory().createCQuery();
		query.setCommand(sql.toString());
		logger.debug("TSysActionDao.queryActionByFunctionLevel() SQL->"+query.getCommand());
		list = query.getDynaBeanMapList("T_ACTION", con);
		return list;
	}
	
	/**
	* 查询功能包含的操作【操作表:T_SYS_ACTION】信息
	* @param con
	* @param pkFunction 功能ID
	* @return
	* @throws Exception
	* @author 陈伟
	*
	*/
	@SuppressWarnings("unchecked")
	public static List queryActionByFunction(Connection con)throws Exception{
		List list = new LinkedList();
		StringBuffer sql = new StringBuffer();
		sql.append("select a.ACTION_ID,a.ACTION_NAME,fa.FUNCTION_ID from T_ACTION a ")
		.append("inner join T_FUNCTION_ACTION fa on a.ACTION_ID = fa.ACTION_ID ")
		.append("order by a.ACTION_ID asc");
		CQuery query = CQueryFactoryTool.createFactory().createCQuery();
		query.setCommand(sql.toString());
		logger.debug("TSysActionDao.queryActionByFunction() SQL->"+query.getCommand());
		list = query.getDynaBeanMapList("T_ACTION", con);
		return list;
	}
	
}
